Capacitive sensing devices are used in a variety of input devices, such as in a trackpad, a touchscreen display, and a fingerprint sensing device. A fingerprint sensing device can capture an image of a fingerprint by measuring the capacitance between the finger and the capacitive sensing elements in the capacitive sensing device. Defects in a layer disposed over the capacitive sensing device can produce errors in the capacitance measurements for one or more capacitive sensing elements. For example, if an air gap is embedded in a layer, the air gap produces a local variation in the dielectric constant of that layer. The fingerprint sensing device may not be able to distinguish the variations produced by a finger touching the fingerprint sensing device from the local variation caused by the air gap. The variation produced by the defect is an additional variation that can result in one or more artifacts in the image of the fingerprint.